***************************************************
**** replication data for Let's work together *****
********** Holman, Mahoney, and Hurler ************
***************************************************

clear

**** set working directory here *** 
	
use "bill_outcomes.dta" 




**** Table 2 / Figure 1 **** 

eststo one_up: mixed up_for_vote any_female_sponsor n_sponsors per_women republican party_control  polarization squire2017 house govparty dem_pres termlimits || year_state:
eststo one_law: mixed signed_law any_female_sponsor  n_sponsors per_women republican party_control  polarization squire2017 house govparty dem_pres termlimits  || year_state:
eststo multi_up: mixed up_for_vote multiple_female_sponsor  n_sponsors per_women republican party_control  polarization squire2017 house govparty dem_pres termlimits  || year_state:
eststo multi_law: mixed signed_law multiple_female_sponsor   n_sponsors per_women republican party_control  polarization squire2017 house govparty dem_pres termlimits || year_state:
eststo bipart_up: mixed up_for_vote bipartisan_female_sponsor  n_sponsors per_women republican party_control  polarization squire2017 house govparty dem_pres termlimits || year_state:
eststo bipart_law: mixed signed_law bipartisan_female_sponsor   n_sponsors per_women republican party_control  polarization squire2017 house govparty dem_pres termlimits  || year_state:

# delimit ;
esttab using figure1table1.rtf, nogap se b(%9.2f) starlevels(^ .10 * .05 ** .01 *** .001) r2(%9.2f) 
	title("Women's effect on bill success" )
	 label
	//addnote("Dependent variable")//
	compress replace;
 #delimit cr


	coefplot  (one_up multi_up bipart_up, label(Up for Vote)) (one_law multi_law bipart_law, label(Signed into Law))  ///
	||, drop(_cons  n_sponsors per_women republican party_control  polarization squire2017 house govparty dem_pres termlimits ) ///
	format(%9.3f) xlabel(,labsize(small)) ytitle("Change in probability of bill reaching stage") yline(0, lpattern(dash) lcolor(gray) lwidth(vthin)) ///
	legend(size(small)) scheme(s1mono) ysize(3)   byopts(cols(3))  title() vertical grid(between) graphregion(margin(medlarge)) ///
	yscale(range(0 .1)) ylabel(0 "0%" .02 "2%" 0.04 "4%" .06 "6%" .08 "8%" .1 "10%")
	graph save figure1_multi_bipart.gph, replace
	graph export figure1_multi_bipart.png, replace width(1800)
	
*** Appendix 1 basic models no controls **** 
eststo clear

eststo one_up: mixed up_for_vote any_female_sponsor  || year_state:
eststo one_law: mixed signed_law any_female_sponsor  || year_state:
eststo multi_up: mixed up_for_vote multiple_female_sponsor  || year_state:
eststo multi_law: mixed signed_law multiple_female_sponsor   || year_state:
eststo bipart_up: mixed up_for_vote bipartisan_female_sponsor   || year_state:
eststo bipart_law: mixed signed_law bipartisan_female_sponsor   || year_state:

# delimit ;
esttab using appendix1basemodel.rtf, nogap se b(%9.2f) starlevels(^ .10 * .05 ** .01 *** .001) r2(%9.2f) 
	title("Women's effect on bill success" )
	 label nonumbers
	//addnote("Dependent variable")//
	compress replace;
 #delimit cr

	coefplot  (one_up multi_up bipart_up, label(Up for Vote)) (one_law multi_law bipart_law, label(Signed into Law))  ///
	||, drop(_cons  ) ///
	format(%9.3f) xlabel(,labsize(small)) ytitle("Change in probability of bill reaching stage") yline(0, lpattern(dash) lcolor(gray) lwidth(vthin)) ///
	legend(size(small)) scheme(s1mono) ysize(3)   byopts(cols(3))  title() vertical grid(between) graphregion(margin(medlarge)) ///
	yscale(range(0 .1)) ylabel(0 "0%" .02 "2%" 0.04 "4%" .06 "6%" .08 "8%" .1 "10%")
	graph save appendix_simple.gph, replace
	graph export appendix_simple.png, replace width(1800)

eststo clear


*** Appendix 2 basic models - ols **** 


eststo one_up: reg up_for_vote any_female_sponsor n_sponsors per_women republican party_control  polarization squire2017 house govparty dem_pres termlimits 
eststo one_law: reg signed_law any_female_sponsor  n_sponsors per_women republican party_control  polarization squire2017 house govparty dem_pres termlimits  
eststo multi_up: reg up_for_vote multiple_female_sponsor  n_sponsors per_women republican party_control  polarization squire2017 house govparty dem_pres termlimits  
eststo multi_law: reg signed_law multiple_female_sponsor   n_sponsors per_women republican party_control  polarization squire2017 house govparty dem_pres termlimits 
eststo bipart_up: reg up_for_vote bipartisan_female_sponsor  n_sponsors per_women republican party_control  polarization squire2017 house govparty dem_pres termlimits 
eststo bipart_law: reg signed_law bipartisan_female_sponsor   n_sponsors per_women republican party_control  polarization squire2017 house govparty dem_pres termlimits  

# delimit ;
esttab using appendix2basemodel.rtf, nogap se b(%9.2f) starlevels(^ .10 * .05 ** .01 *** .001) r2(%9.2f) 
	title("Women's effect on bill success" )
	 label nonumbers
	//addnote("Dependent variable")//
	compress replace;
 #delimit cr
 
	coefplot  (one_up multi_up bipart_up, label(Up for Vote)) (one_law multi_law bipart_law, label(Signed into Law))  ///
	||, drop(_cons  n_sponsors per_women republican party_control  polarization squire2017 house govparty dem_pres termlimits ) ///
	format(%9.3f) xlabel(,labsize(small)) ytitle("Change in probability of bill reaching stage") yline(0, lpattern(dash) lcolor(gray) lwidth(vthin)) ///
	legend(size(small)) scheme(s1mono) ysize(3)   byopts(cols(3))  title() vertical grid(between) graphregion(margin(medlarge)) ///
	yscale(range(0 .1)) ylabel(0 "0%" .02 "2%" 0.04 "4%" .06 "6%" .08 "8%" .1 "10%")
	graph save appendix_reg.gph, replace
	graph export appendix_reg.png, replace width(1800)

eststo clear
	
**** Figure 2 alternative baseline / Appendix 3 **** 

eststo clear 

eststo multi_up2: mixed up_for_vote multiple_female_sponsor  n_sponsors per_women republican party_control  polarization squire2017 house govparty dem_pres termlimits  if multiple_sponsors == 1|| year_state:
eststo bipart_up2: mixed up_for_vote bipartisan_female_sponsor  n_sponsors per_women republican party_control  polarization squire2017 house govparty dem_pres termlimits  if bipartisan_sponsors == 1 || year_state:
eststo multi_vote2: mixed signed_law  multiple_female_sponsor   n_sponsors per_women republican party_control  polarization squire2017 house govparty dem_pres termlimits  if multiple_sponsors == 1 || year_state:
eststo bipart_vote2: mixed signed_law   bipartisan_female_sponsor  n_sponsors per_women republican party_control  polarization squire2017 house govparty dem_pres termlimits  if bipartisan_sponsors == 1 || year_state:



# delimit ;
esttab using appendix3.rtf, nogap se b(%9.2f) starlevels(^ .10 * .05 ** .01 *** .001) r2(%9.2f) 
	title("Women's effect on bill success" )
	 label
	//addnote("Dependent variable")//
	compress replace;
 #delimit cr

	
	coefplot (multi_up2 bipart_up2, label(Up for Vote)) (multi_vote2 bipart_vote2, label(Signed into Law))     ///
	||, drop(_cons  n_sponsors per_women republican party_control  polarization squire2017 house govparty dem_pres termlimits )  saving (coefplot_alt_baseline, replace)  ///
	format(%9.3f) ytitle("Change in probability of bill reaching stage") ysize(3)	xlabel(,labsize(small)) yline(0, lpattern(dash) lcolor(gray) lwidth(vthin)) ///
	legend(size(small)) scheme(s1mono)  title() vertical grid(between) graphregion(margin(medlarge)) ///
	ylabel(0 "0%" .005 ".5%" 0.01 "1%" .015 "1.5%" .02 "2%" .025 "2.5%" .03 "3%" .035 "3.5%")

graph save figure2_alt_baseline.gph, replace
graph export figure2_alt_baseline.eps, replace 
graph export figure2_alt_baseline.png, replace width(1800)

**** Figure 3 and appendix 4 term limits **** 


eststo clear
eststo any1noterm: xtmixed signed_law any_female_sponsor  n_sponsors per_women republican party_control polarization squire2017 termlimits dem_pres if termlimits == 0 || year_state:
eststo any1term: xtmixed signed_law any_female_sponsor  n_sponsors per_women republican party_control polarization squire2017 termlimits dem_pres if termlimits == 1 || year_state:
eststo any2noterm: xtmixed up_for_vote any_female_sponsor  n_sponsors per_women republican party_control polarization squire2017 termlimits dem_pres if termlimits == 0 || year_state:
eststo any2term: xtmixed up_for_vote any_female_sponsor n_sponsors per_women republican party_control polarization squire2017 termlimits dem_pres if termlimits == 1 || year_state:

eststo multi1noterm: xtmixed signed_law multiple_female_sponsor  n_sponsors per_women republican party_control polarization squire2017 termlimits dem_pres if termlimits == 0 || year_state:
eststo multi1term: xtmixed signed_law multiple_female_sponsor  n_sponsors per_women republican party_control polarization squire2017 termlimits dem_pres if termlimits == 1 || year_state:
eststo multi2noterm: xtmixed up_for_vote multiple_female_sponsor  n_sponsors per_women republican party_control polarization squire2017 termlimits dem_pres if termlimits == 0 || year_state:
eststo multi2term: xtmixed up_for_vote multiple_female_sponsor  n_sponsors per_women republican party_control polarization squire2017 termlimits dem_pres if termlimits == 1 || year_state:

eststo bipart1noterm: xtmixed signed_law bipartisan_female_sponsor  n_sponsors per_women republican party_control polarization squire2017 termlimits dem_pres if termlimits == 0 || year_state:
eststo bipart1term: xtmixed signed_law bipartisan_female_sponsor  n_sponsors per_women republican party_control polarization squire2017 termlimits dem_pres if termlimits == 1 || year_state:
eststo bipart2noterm: xtmixed up_for_vote bipartisan_female_sponsor  n_sponsors per_women republican party_control polarization squire2017 termlimits dem_pres if termlimits == 0 || year_state:
eststo bipart2term: xtmixed up_for_vote bipartisan_female_sponsor  n_sponsors per_women republican party_control polarization squire2017 termlimits dem_pres if termlimits == 1 || year_state:

# delimit ;
esttab using appendix4termlimits.rtf, nogap se b(%9.2f) starlevels(^ .10 * .05 ** .01 *** .001) r2(%9.2f) 
	title("Term limits and no term limits" )
	 label nonumbers
	//addnote("Dependent variable")//
	compress replace;
 #delimit cr


	coefplot (any2noterm  multi2noterm bipart2noterm, label(Up for Vote)) (any1noterm multi1noterm bipart1noterm, label(Signed into Law)) ///
	||, drop(_cons  n_sponsors per_women republican party_control  polarization squire2017 house govparty dem_pres termlimits )  ///
	format(%9.3f) title("No Term Limits") ysize(3)ylabel(0[.05].20)	yla(, format(%9.2f)) xlabel(,labsize(medsmall)) yline(0, lpattern(dash) lcolor(gray) lwidth(vthin)) legend(off) ///
	legend(size(small)) scheme(s1mono) yscale(range(0 .1)) ylabel(0 "0%" 0.04 "4%" .08 "8%" .12 "12%") ///
	title() vertical grid(between) graphregion(margin(medlarge))
	
graph save noterm.gph, replace
graph export noterm.eps, replace 
graph export noterm.png, replace width(1800)

	coefplot (any2term  multi2term bipart2term, label(Up for Vote)) (any1term multi1term bipart1term, label(Signed into Law)) ///	
	||, drop(_cons n_sponsors per_women republican party_control  polarization squire2017 house govparty dem_pres termlimits )  	///
	format(%9.3f) title("Term Limits") ysize(3) ylabel(0[.05].20) yla(, format(%9.2f)) xlabel(,labsize(medsmall)) yline(0, lpattern(dash) lcolor(gray) lwidth(vthin))  ///
	legend(size(small)) scheme(s1mono) yscale(range(0 .1)) ylabel(0 "0%" 0.04 "4%" .08 "8%" .12 "12%" ) ///
	title() vertical grid(between) graphregion(margin(medlarge))
	
graph save term.gph, replace
graph export term.eps, replace 
graph export term.png, replace width(1800)
 
graph combine  "term" "noterm", scheme(s1mono) col(1) graphregion(margin(none)) ysize(3.5) 
graph save figure3_term_combined.gph, replace
graph export figure3_term_combined.eps, replace 
graph export figure3_term_combined.png, replace width(1800)
	

**** Figure 4 and Appendix 5 party control **** 
eststo clear
eststo party_control_any1r: xtmixed signed_law any_female_sponsor  n_sponsors per_women republican party_control polarization squire2017 termlimits dem_pres if party_control == 0 || year_state:
eststo party_control_any1d: xtmixed signed_law any_female_sponsor  n_sponsors per_women republican party_control polarization squire2017 termlimits dem_pres if party_control == 1 || year_state:
eststo party_control_any2r: xtmixed up_for_vote any_female_sponsor  n_sponsors per_women republican party_control polarization squire2017 termlimits dem_pres if party_control == 0 || year_state:
eststo party_control_any2d: xtmixed up_for_vote any_female_sponsor n_sponsors per_women republican party_control polarization squire2017 termlimits dem_pres if party_control == 1 || year_state:

eststo party_control_multi1r: xtmixed signed_law multiple_female_sponsor  n_sponsors per_women republican party_control polarization squire2017 termlimits dem_pres if party_control == 0 || year_state:
eststo party_control_multi1d: xtmixed signed_law multiple_female_sponsor  n_sponsors per_women republican party_control polarization squire2017 termlimits dem_pres if party_control == 1 || year_state:
eststo party_control_multi2r: xtmixed up_for_vote multiple_female_sponsor  n_sponsors per_women republican party_control polarization squire2017 termlimits dem_pres if party_control == 0 || year_state:
eststo party_control_multi2d: xtmixed up_for_vote multiple_female_sponsor  n_sponsors per_women republican party_control polarization squire2017 termlimits dem_pres if party_control == 1 || year_state:


eststo party_control_bipart1r: xtmixed signed_law bipartisan_female_sponsor  n_sponsors per_women republican party_control polarization squire2017 termlimits dem_pres if party_control == 0 || year_state:
eststo party_control_bipart1d: xtmixed signed_law bipartisan_female_sponsor  n_sponsors per_women republican party_control polarization squire2017 termlimits dem_pres if party_control == 1 || year_state:
eststo party_control_bipart2r: xtmixed up_for_vote bipartisan_female_sponsor  n_sponsors per_women republican party_control polarization squire2017 termlimits dem_pres if party_control == 0 || year_state:
eststo party_control_bipart2d: xtmixed up_for_vote bipartisan_female_sponsor  n_sponsors per_women republican party_control polarization squire2017 termlimits dem_pres if party_control == 1 || year_state:


# delimit ;
esttab using party_control.rtf, nogap se b(%9.2f) starlevels(^ .10 * .05 ** .01 *** .001) r2(%9.2f) 
	title("Republican and Dem party control" )
	 label
	//addnote("Dependent variable")//
	compress replace;
 #delimit cr


	coefplot (party_control_any2r  party_control_multi2r party_control_bipart2r, label(Up for Vote)) (party_control_any1r party_control_multi1r party_control_bipart1r, label(Signed into Law)) ///
	||, drop(_cons  n_sponsors per_women republican party_control  polarization squire2017 house govparty dem_pres termlimits )  ///
	format(%9.3f) title("Republican Control") ysize(3)ylabel(0[.05].20)	yla(, format(%9.2f)) xlabel(,labsize(medsmall)) yline(0, lpattern(dash) lcolor(gray) lwidth(vthin)) legend(off) ///
	legend(size(small)) scheme(s1mono) yscale(range(0 .1)) ylabel(0 "0%" 0.04 "4%" .08 "8%" .12 "12%") ///
	title() vertical grid(between) graphregion(margin(medlarge))
	
graph save republican.gph, replace
graph export republican.eps, replace 
graph export republican.png, replace width(1800)

	coefplot (party_control_any2d  party_control_multi2d party_control_bipart2d, label(Up for Vote)) (party_control_any1d party_control_multi1d party_control_bipart1d, label(Signed into Law)) ///	
	||, drop(_cons   n_sponsors per_women republican party_control  polarization squire2017 house govparty dem_pres termlimits )  	///
	format(%9.3f) title("Democratic Control") ysize(3) ylabel(0[.05].20) yla(, format(%9.2f)) xlabel(,labsize(medsmall)) yline(0, lpattern(dash) lcolor(gray) lwidth(vthin))  ///
	legend(size(small)) scheme(s1mono) yscale(range(0 .1)) ylabel(0 "0%" 0.04 "4%" .08 "8%" .12 "12%") ///
	title() vertical grid(between) graphregion(margin(medlarge))
	
graph save democrats.gph, replace
graph export democrats.eps, replace 
graph export democrats.png, replace width(1800)
 
graph combine "republican" "democrats", scheme(s1mono) col(1) graphregion(margin(none)) ysize(3.5) 
graph save figure4_party_combined.gph, replace
graph export figure4_party_combined.eps, replace 
graph export figure4_party_combined.png, replace width(1800)

